package edu.android.com;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.AdapterView.OnItemClickListener;

public class directed extends Activity {
	 @Override
	    public void onCreate(Bundle savedInstanceState) {
	        super.onCreate(savedInstanceState);
	        setContentView(R.layout.directed);
	        
	        //Menu
	       manageMenu();
	    }
	 
	 	private void manageMenu()
	    {
	        String [] items = new String[]{
	        		"Depth-First",
	        		"Breadth-First",
	        		"Topological Sort",
	        		"Dijkstra",
	        		"Maximum Flow"};
	        
	        ArrayAdapter adapter = new ArrayAdapter <String>(this,R.layout.textview,items);
	        ListView list = (ListView)findViewById(R.id.directedList);
	        list.setAdapter(adapter);
	        
	        list.setOnItemClickListener(new OnItemClickListener(){

				@Override
				public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
						long arg3) {
					// TODO Auto-generated method stub
					Intent intent;
					switch(arg2){
					case 0:
						intent = new Intent(directed.this,dirDF.class);
						startActivity(intent);
						break;
					case 1:
						intent = new Intent(directed.this,dirBF.class);
						startActivity(intent);
						break;
					case 2:
						intent = new Intent(directed.this,dirTopSort.class);
						startActivity(intent);
						break;
					case 3:
						intent = new Intent(directed.this,dirDijkstra.class);
						startActivity(intent);
						break;
					case 4:
						intent = new Intent(directed.this,dirFlow.class);
						startActivity(intent);
						break;
					}
				}
	        	
	        });
	    }
}
